Skip to main content

Human Face Detection

Overview

This example demonstrates human face detection based on deep learning and provides a lightweight, extensible framework for face-related applications.

The project is developed using theESP-DL library,which offers deep learning capabilities within the ESP-WHO framework. With support for different hardware modules, it can be used in various AIoT scenarios.

Development Preparation

Hardware

  • NE100-MB01 Development Board

Software

1. Firmware:

Download pre-compiled firmware for use:

2. Environment Requirements

To perform secondary development, make sure the following:

  • IDE Software:Visual Studio Code(v1.99.2+)
  • Development Framework:ESP-IDF Extension(v5.1.6)
  • Example Repositorycamthink-ai/esp-who

Important:Please follow the Development Environment Setup Guide to complete the initial configuration.

Functionality Verification

Using Precompiled Firmware

1. Hardware Connection

Connect the development board to PC using a Type-C cable.

NE101 interface

2. Firmware flashing

Refer to the detailed flashing guide:

3. UART Output Analysis

The device outputs face detection results via the serial port (baud rate: 115200):

Example Code:

WhoDetect: 0, bbox: [0.826712, 47, 40, 169, 195], left_eye: [80, 105], left_mouth: [90, 151], nose: [101, 125], right_eye: [123, 99], right_mouth: [126, 146]

Field Descriptions

  • bbox:Face bounding box information
    • Format:[confidence, top-left x, top-left y, width, height]
  • left_eye:Coordinates of the left eye(x,y)
  • right_eye: Coordinates of the right eye (x,y)
  • nose:Coordinates of the nose(x,y)
  • left_mouth:Coordinates of the left mouth corner(x,y)
  • right_mouth:Coordinates of the right mouth corner(x,y)

4. Performance Test

  1. Point the camera at a real human face or a face image.
  2. Observe the serial output for facial landmark data.
  3. Move the camera around to test dynamic face detection performance.

Static Illustration of Face Detection

Real-Time Face Detection Example

Source Code Development

1. Clone the repository using the following command

git clone https://github.com/camthink-ai/esp-who

2. Project setup

  1. Open the directory in VS Code:examples/human_face_detect

    Project Root Directory

  2. Select esp32-s3 as the target chip:

    芯片选择界面

3. Compile and deploy the source code

  1. Select the build button to compile the source code:

    Esp32s3 selection

  2. Select the flash button to upload the generated firmware to the device:

    Showing build output

4. Performance Test

Same with using precompiled firmware

References

  1. ESP-DL Model Quantization Documentation:

  2. Official Example Repository: